{include file="../Public/header.html"}
<script type="text/javascript" src="__PUBLIC__/Js/jquery.SetTableBgColor.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/dataList.js"></script>
<script type="text/javascript">
var g = '{$smarty.const.GROUP_NAME}';
var m = '{$smarty.const.MODULE_NAME}';
var _hash_ = '{$_hash_}';
<!--{literal}-->
function add_rec_pos(form)
{
	if(form.name.value == ''){
		$('#dialog>p').html('请输入推荐位名称');
		$('#dialog').dialog('open');
		return false;
	}
	var url = "?g="+g+"&m="+m+"&a=add_rec_pos&name="+encodeURIComponent(form.name.value)+"&ajax=1&_hash_="+_hash_;
	$.getJSON(url, function(data){
			if(data.status == 0){
				$('#dialog>p').html('添加失败');
				$('#dialog').dialog('open');
			}else{
				$('#dialog>p').html('添加成功');
				$('#dialog').dialog('open');
				window.location.href = document.URL;
			}
			_hash_ = data.info;
	});
	return false;
}
function del(id)
{
	$('#dialog>p').html('将删除相关的推荐店铺<br />确定要删除吗？');
	$('#dialog').dialog('open');
	$('#dialog').dialog({
					autoOpen: false,
					width: 300,
					buttons: {
						"确定": function() { 
							var url = "?g="+g+"&m="+m+"&a=del_rec_pos&id="+id+"&ajax=1&_hash_="+_hash_;
							$.getJSON(url, function(data){
													if(data.status == 0){
														$('#dialog>p').html('删除失败');
														$('#dialog').dialog('open');
													}else{
														window.location.href = document.URL;
													}
													});
						},
						"取消": function() { 
							$(this).dialog("close"); 
						}
					}
				});
}
$(document).ready(function(){
	$(".table-list").SetTableBgColor({
            odd:"even",
            even:"",
            selected:"",
            over:""
        });
});
<!--{/literal}-->
</script>
<div class="handle-btns">
</div>
<div class="search-box">
    <form action="?g={$smarty.const.GROUP_NAME}&m={$smarty.const.MODULE_NAME}&a=add_rec_pos" onsubmit="return add_rec_pos(this)">
        <span>推荐位名称</span>
        <input type="text" size="12" name="name" value="" class="textinput">
		<input type="submit" value="添加推荐位" class="submit_btn">
  </form>
</div>
<table cellspacing="0" cellpadding="0" border="0" class="table-list list" id="checkList">
<thead>
<tr>
<th width="30" class="first">&nbsp;</th>
<th width="30">ID</th>
<th align="left">名称</th>
<th width="90">操作</th>
</tr>
</thead>
<tbody>
<!--{foreach from=$rec_pos item=item}-->
<tr id="tt-item-{$item.id}">
<td class="first">&nbsp;</td>
<td>{$item.id}</td>
<td align="left"><span class="pointer" module="{$smarty.const.MODULE_NAME}" group="{$smarty.const.GROUP_NAME}" model="tao_coupon_rec_pos" pk="" href="javascript:;" onclick="textEdit(this,'{$item.id}','name')">{$item.name}</span></td>
<td align="left"><a href="javascript:;" onclick="del($item.id)">删除</a></td>
</tr>
<!--{/foreach}-->
</tbody></table>
{include file="../Public/footer.html"}